﻿//This file is part of the Generic Database Accessor Library (GDALib) project
//Copyright (C) 2009 Gentea Alexandru <in.10se@yahoo.com>
//
//This library is free software; you can redistribute it and/or
//modify it under the terms of the GNU Lesser General Public
//License as published by the Free Software Foundation; either
//version 2.1 of the License, or (at your option) any later version.
//
//This library is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//Lesser General Public License for more details.
//
//You should have received a copy of the GNU Lesser General Public
//License along with this library; if not, write to the Free Software
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
using System;

namespace GDALib
{
    /// <summary>
    /// Represents an object that encapsulates information about an exception or error that occured in the DatabaseAccessor object.
    /// </summary>
    public class DatabaseAccessorEventArgs : EventArgs
    {
        Exception exception;
        String commandText;
        object[] parameters;

        /// <summary>
        /// The actual exception object that was raised.
        /// </summary>
        public Exception Exception
        {
            get { return exception; }
        }

        /// <summary>
        /// The text of the command which raised the exception.
        /// </summary>
        public String CommandText
        {
            get { return commandText; }
        }

        /// <summary>
        /// The parameters, if any, of the command which raised the exception.
        /// </summary>
        public object[] Parameters
        {
            get { return parameters; }
        }

        internal DatabaseAccessorEventArgs(Exception exception, String commandText, object[] parameters)
        {
            this.exception = exception;
            this.commandText = commandText;
            this.parameters = parameters;
        }
    }
}
